#!/bin/sh
echo I am provisioning...
sudo sh -c 'date > /etc/vagrant_provisioned_at'
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -q python-software-properties
sudo add-apt-repository ppa:presslabs/gitfs-dev
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -q python-virtualenv python-dev libffi-dev build-essential git-core python3.5-dev libgit2-dev
sudo adduser "$USER" fuse
sudo pip install -U virtualenv
sudo sh -c "echo 'user_allow_other' >> /etc/fuse.conf"
virtualenv -q --setuptools -ppython3.5 /home/vagrant/gitfs
echo "source $HOME/gitfs/bin/activate" >> "$HOME/.bashrc"
echo Installing cffi
/home/vagrant/gitfs/bin/pip install -q 'cffi'
echo Installing requirements
/home/vagrant/gitfs/bin/pip install -q -r /vagrant/test_requirements.txt
echo Configuring git
git config --global user.email "vagrant@localhost"
git config --global user.name "Vagrant"
echo Installing gitfs
"$HOME/gitfs/bin/pip" install -q -e /vagrant
